let go_h5pay = (data = []) => {
	const system = uni.getSystemInfoSync()
	if (system.platform == 'ios') {
		window.location.href = data
	} else {
		window.open(data)
	}
}
let go_mpwxpay = (data = []) => {
	return new Promise((resolve, reject) => {
		uni.requestPayment({
			provider: 'wxpay',
			orderInfo: data,
			appId: data.appId,
			timeStamp: data.timeStamp,
			nonceStr: data.nonceStr,
			package: data.package,
			signType: data.signType,
			paySign: data.paySign,
			success: (res) => {
				resolve(res)
			},
			fail: (err) => {
				this.$tip.tip(this.$t("支付失败"))
				reject(err)
			}
		});
	})
}
let go_appwxpay = (data = []) => {
	return new Promise((resolve, reject) => {
		uni.requestPayment({
			provider: 'wxpay',
			orderInfo: data,
			success: (res) => {
				resolve(res)
			},
			fail: (err) => {
				this.$tip.tip(this.$t("支付失败"))
				reject(err)
			}
		});
	})
}
let go_appalipay = (data = []) => {
	return new Promise((resolve, reject) => {
		uni.requestPayment({
			provider: 'alipay',
			orderInfo: data,
			success: (res) => {
				resolve(res)
			},
			fail: (err) => {
				reject(err)
			}
		});
	})
}

function debounceClick(methods, info) {
	// methods是需要点击后需要执行的函数， info是点击需要传的参数
	let that = this;
	if (that.noClick) {
		// 第一次点击
		that.noClick = false;
		if (info && info !== '') {
			// info是执行函数需要传的参数
			methods(info);
		} else {
			methods();
		}
		setTimeout(() => {
			that.noClick = true;
		}, 2000)
	} else {
		// 这里是重复点击的判断
	}
}
	module.exports = {
		go_h5pay,
		go_mpwxpay,
		go_appwxpay,
		go_appalipay,
		debounceClick
	}
